# -*- coding: utf-8 -*-
#
# Author:: hanjunfeng
# Date:: 2023/4/7

from submodules.common.lib.log_ import logger
from submodules.common.lib.traceback_ import format_stack_str




def assert_soft(condition, message=None):
    try:
        if not condition:
            if message:
                raise AssertionError(message)
            else:
                raise AssertionError
    except Exception as e:
        logger.error(repr(e))
        logger.error(format_stack_str())


if __name__ == "__main__":
    def test_assert_soft():
        assert_soft(1 == 2, "test assert fail")


    test_assert_soft()
